<template>
    <div class="content">
        <div class="typeArea">
            <el-form :inline='true' :label-position="labelPosition" label-width="80px" :model="addBookForm">
                <el-form-item label="小说名">
                    <el-input name='bookName' v-model="addBookForm.bookName" ></el-input>
                </el-form-item>
                <el-form-item label="小说类型">
                    <el-input name='style' v-model="addBookForm.style"></el-input>
                </el-form-item>
                <el-form-item label="作者">
                    <el-input name='author' v-model="addBookForm.author"></el-input>
                </el-form-item>
                <el-form-item label="小说状态">
                    <el-input name='status' v-model="addBookForm.status"></el-input>
                </el-form-item>
                <!--<el-form-item label="图片">-->
                    <!--<span class="imgbox"><input type="file" class="uploadPicture"></span>-->
                <!--</el-form-item>-->
                <el-form-item>
                    <el-button type="primary" @click="sendToBook">提交</el-button>
                </el-form-item>
            </el-form>
            <el-form :label-position="labelPosition" label-width="80px" :model="addBookContain">
                <el-form-item label="小说简介">
                    <el-input type="textarea" v-model="addBookContain.introduct" rows='10'></el-input>
                </el-form-item>
            </el-form>
        </div>
    </div>
</template>
<script>
    import {Message} from "element-ui";
    export default{
        data:function(){
            return {
                imgUrl:'',
                labelPosition: 'right',
                addBookForm: {
                    bookId: '',
                    bookName: '',
                    style: '',
                    status: '',
                    author: '',
                },
                addBookContain:{
                    introduct:""
                }
            }
        },
        methods:{
            sendToBook(){
                this.$http.post('http://localhost/api/addBook',{bookName:this.addBookForm.bookName,style:this.addBookForm.style,introduct:this.addBookContain.introduct,status:this.addBookForm.status,author:this.addBookForm.author},{emulateJSON:true}).then(function (result) {
                    console.log(result);
                    Message({
                        message:result.body.message
                    })
                })
            }
        }
    }
</script>
<style scoped>
    .typeArea>input[type="textarea"]{
        width: 100%;
    }
    .typeArea{
        padding: 20px;
    }
    .imgbox{
        background: url('../static/images/32.png');
        background-position: 0px -11px;
        display: inline-block;
        width: 64px;
        height: 64px;
        margin-right: 184px;

    }
    .uploadPicture{
        height: 36px;
        width: 40px;
        opacity: 0;
    }
</style>